import java.util.Scanner;

public class a016_數獨_SUDOKU {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean sudoku_ox;
		final int one_plus_to_nine = 45;
		
		int[][] sudoku = new int[9][9];
		
		int ninth1 = 0, ninth2 = 0, ninth3 = 0;
		
		while(sc.hasNext()) {
			// 數獨判斷
			sudoku_ox = true;
			
			// 列
			for(int i = 0; i < 9; i++) {				
				// 初始化每三行的第一行
				if(i == 0 || i == 3 || i ==6)
					ninth1 = ninth2 = ninth3 = 0;
				
				// 行
				for(int j = 0; j < 9; j++) {
					sudoku[i][j] = sc.nextInt();
					
					if(j <= 0 || j < 3)
						ninth1 += sudoku[i][j];
					else if(j <= 3 || j < 6)
						ninth2 += sudoku[i][j];
					else if(j <= 6 || j <9)
						ninth3 += sudoku[i][j];
					
					// 判斷每 3 * 3 (九分之一) 加總是否為45
					if(i == 2 && j == 8) {
						if(ninth1 != one_plus_to_nine || ninth2 != one_plus_to_nine || ninth3 != one_plus_to_nine)
							sudoku_ox = false;
					}
					else if(i == 5 && j == 8) {
						if(ninth1 != one_plus_to_nine || ninth2 != one_plus_to_nine || ninth3 != one_plus_to_nine)
							sudoku_ox = false;
					}
					else if(i == 8 && j == 8) {
						if(ninth1 != one_plus_to_nine || ninth2 != one_plus_to_nine || ninth3 != one_plus_to_nine)
							sudoku_ox = false;
					}
					
					// 判斷每行加總是否為45
					if(i == 8) {
						if(sudoku[0][j] + sudoku[1][j] + sudoku[2][j] + sudoku[3][j] + sudoku[4][j] + sudoku[5][j] + sudoku[6][j] + sudoku[7][j] + sudoku[8][j] != one_plus_to_nine)
							sudoku_ox = false;
					}
				} // 行
				
				// 判斷每列加總是否為45
				if(sudoku[i][0] + sudoku[i][1] + sudoku[i][2] + sudoku[i][3] + sudoku[i][4] + sudoku[i][5] + sudoku[i][6] + sudoku[i][7] + sudoku[i][8] != one_plus_to_nine)		
					sudoku_ox = false;
				
				sc.nextLine();
			} // 列
			
			if(sudoku_ox)
				System.out.println("yes");
			else
				System.out.println("no");
		} // next
	} // main
	
}